home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Alles Voor Internet / Tout Pour Internet
/
alles voor internet.iso
/
MacInternet™
/
SLIP
/
Tone
/
ADI-100_v1.6
next >
Wrap
Text File
|
1994-10-19
|
7KB
|
330 lines
#
# script for ADI-100 19200 bps
#
# You should preset the following parameters by using
# the "Parameters..." item under the "Script" popup
# menu after selecting this script:
#
# $DisconnectString
# $phone
# $user
# $password
# $PromptForPhoneNumber Must be YES to work (not yes)
# $PromptForUserName Must be YES to work (not yes)
# $PromptForPassword Must be YES to work (not yes)
#
#
# Let the user know we're starting up. Set up a global
# abort action.
on abort goto abort
if "$PromptForPhoneNumber" ne "YES" goto nextone
# Ask for the phone number.
message " \n\n"
message "\bPlease enter the phone number:"
ask phone
message " \n"
message "Thank you.\n"
label nextone
if "$PromptForUserName" ne "YES" goto nexttwo
# Ask for the username.
message " \n\n"
message "\b Please enter your username:"
ask user
message " \n"
message "Thank you.\n"
label nexttwo
if "$PromptForPassword" ne "YES" goto nextthree
# Ask for a password to log into the SLIP server.
message " \n\n"
message "Contacting SLIP server as $user.\n"
message "\b Please enter your password:"
askp password
message " \n"
message "Thank you.\n"
label nextthree
#
# Turn DTR off; wait a bit; turn it back on
#
dtr off
message "Initializing modem..."
delay 2
dtr on
flush
send "\r"
{
iftime 5 cantinitterminal
ifmatch "CHANGE(T) >" break
}
flush
send "\r"
{
iftime 10 cantinitterminal
ifmatch "CHANGE(T) >" break
}
#
# Termial type must be 96
#
flush
message "Changing terminal type..."
send "T\r"
{
ifmatch "TYPE >" break
ifmatch "TIMEOUT" goto nocarrier # this has never been tested, but it should work
iftime 15 goto dialtimeout
}
# Dial the phone and wait for the terminal server
# to send its login banner. Some terminal servers
# may require you to autobaud before they will respond.
# Allow enough time for the modem handshake to complete.
message "Terminal Changed..."
flush
send "19\r"
{
ifmatch "CHANGE(T)" break #
ifmatch "TIMEOUT" nocarrier #we should not go to the beginning again
iftime 45 goto dialtimeout
}
#
# Let's dial the phone
#
flush
message "Waking ADI-100..."
on abort goto hangupabort # We're about to go off hook, so use different abort handler.
send "D\r"
{
ifmatch "NUMBER >" break
ifmatch "BUSY" goto phonebusy # this has never been tested, but it should work
iftime 15 goto dialtimeout
}
# Dial the phone and wait for the terminal server
# to send its login banner. Some terminal servers
# may require you to autobaud before they will respond.
# Allow enough time for the modem handshake to complete.
set phone 3-0291
message "Dialing $phone..."
flush
on abort goto hangupabort # We're about to go off hook, so use different abort handler.
send "$phone\r"
{
ifmatch "INITIATED" break
ifmatch "BUSY" goto phonebusy #again, this has never been tested
ifmatch "CHANGE(T)" nocarrier #we should not go to the beginning again
ifmatch "TIMEOUT" nocarrier #we should not go to the beginning again
iftime 45 goto dialtimeout
}
linespeed 19200
setcount 2 0
label wakeup
ifcountgt 2 3 goto cantlogin
setcount 3 0
label wakeserver
message "Waking server..."
flush
ifcountgt 3 10 goto cantwakeserver
send "\r"
{
ifmatch "Username:" goto startlogin
iftime 2 goto wakeserver
}
# Log into the terminal server. Try three times to
# send the username. Use counter #1 to count the
# number of login attempts.
label startlogin
setcount 1 0
label login
ifcountgt 1 3 goto cantlogin
message "Logging in as $user..."
setcount 0 0
label user
flush
ifcountgt 0 3 goto baduser
send "$user\r"
{
ifmatch "Password:" break
ifmatch "Username:" goto user
iftime 10 goto baduser
}
# Send your password and wait for the ">" prompt.
# If we see the "Username:" prompt again, then
# we didn't get logged in so try again.
message "Sending password...\n"
flush
send "$password\r"
{
ifmatch ">" goto setslip
ifmatch "Access denied" goto accessdenied
iftime 45 goto cantlogin
}
goto setslip # Shouldn't get here, but just in case.
# If the login attempt fails, we land here. We can
# take whatever action is necessary to get another
# login prompt. In the case of Cisco terminal servers,
# no other action is necessary, so we just look for
# "Username:" immediately. Some systems may require
# a \n to get their attention again. Most recovery
# actions will probably go outside the loop.
label accessdenied
{
ifmatch "Username:" goto login
ifmatch "NO CARRIER" goto cantlogin
iftime 10 goto cantlogin
}
goto cantlogin # Shouldn't get here, but just in case
# Put the terminal line into SLIP mode.
label setslip
message "Setting terminal line for SLIP operation..."
flush
send "term down\r"
{
ifmatch ">" break
iftime 10 goto cantsetterm
}
# Enable SLIP. The SLIP server tells us our MTU in bytes,
# so look for the word "bytes".
message "Enabling SLIP on server..."
flush
send "slip default\r"
{
ifmatch "system" break
iftime 10 goto cantstartslip
}
ipfind IPADDRESS
set IPGWADDRESS 134.84.101.254
set IPNETMASK 255.255.255.0
# All done. Send message to alert the user,
# flush the junk out of the receive buffer,
# and return success.
message "Script complete"
flush
return 1
# Error handlers.
label abort
beep
message "\bOperation cancelled."
goto aborted
label hangupabort
beep
message "\bOperation cancelled."
goto hangup
label cantinitterminal
beep
message "Didn't respond to terminal initialization."
message "Check the ADI-100."
goto aborted
label cantinitmodem
beep
message "The modem didn't respond to initialization."
message "Check the modem."
goto aborted
label nodialtone
beep
message "The modem could not detect a dialtone."
message "Check the phone line."
goto aborted
label inputerror
beep
message "We have an input error."
goto aborted
label phonebusy
beep
message "The number $phone is busy."
goto aborted
label nocarrier
beep
message "The modem could not establish a connection."
message "Is $phone the right number?"
goto aborted
label badinitstring
message "This is the wrong script for the modem"
goto aborted
label dialtimeout
message "The modem or SLIP server isn't responding."
message "Try again."
goto aborted
label cantwakeserver
message "The SLIP server isn't responding."
message "Try again."
goto hangup
label baduser
beep
message "The SLIP server won't accept a username."
message "Try again."
goto hangup
label cantlogin
beep
message "Login to SLIP server failed, check username"
message "and password."
goto hangup
label cantsetterm
beep
message "Can't set terminal line for SLIP operation."
goto hangup
label cantstartslip
beep
message "Can't put server into SLIP mode."
goto hangup
# General back-end for bailing out. Make sure we've hung up the phone.
label hangup
dtr off
label aborted
message "\bScript aborted."
ask junk # This activates the OK button.
flush
return 0
# Stuff to do when "Disconnect" button is pressed.
label disconnect
dtr off
return 1